package com.inno.launcher;

import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;

import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.RadioGroup;

import com.inno.launcher.utils.ScrimUtilKt;

public class ScrimUtilActivity extends AppCompatActivity {

    private ConstraintLayout viewById;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scrim_util);
        viewById = findViewById(R.id.root);
        RadioGroup rgSelect = findViewById(R.id.rg_select);
        rgSelect.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId){
                    case R.id.rb_1:
                        if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
                            viewById.setBackground(//FF424242
                                    ScrimUtilKt.makeCubicGradientScrimDrawable(
                                            Gravity.BOTTOM,0xFF,0x42,0x42,0x42,
                                            8)); //起始方向
                        }
                        break;
                    case R.id.rb_2:
                        if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
                            viewById.setBackground(//FF424242
                                    ScrimUtilKt.makeCubicGradientScrimDrawable(
                                            Gravity.BOTTOM,0xFF,0x42,0x42,0x42,
                                            10)); //起始方向
                        }
                        break;
                }
            }
        });
        if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
            viewById.setBackground(//FF424242
                    ScrimUtilKt.makeCubicGradientScrimDrawable(
                            Gravity.BOTTOM,0xFF,0x42,0x42,0x42,
                            8)); //起始方向
        }
    }
}